package com.bitc.crash.common;

/**
 * 错误码
 */
public enum ErrorCode {

    SUCCESS(0, "ok"),
    PARAMS_ERROR(40000, "请求参数错误"),
    NOT_LOGIN_ERROR(40100, "未登录"),
    NO_AUTH_ERROR(40101, "无权限"),
    NOT_FOUND_ERROR(40400, "请求数据不存在"),
    FORBIDDEN_ERROR(40300, "禁止访问"),
    SYSTEM_ERROR(50000, "系统内部异常"),
    OPERATION_ERROR(50001, "操作失败"),
    
    // 用户相关错误
    USER_NOT_EXIST(40401, "用户不存在"),
    USER_PASSWORD_ERROR(40402, "用户密码错误"),
    USER_DISABLED(40403, "用户已被禁用"),
    
    // 商品相关错误
    COMMODITY_NOT_EXIST(40404, "商品不存在"),
    COMMODITY_STOCK_NOT_ENOUGH(40405, "商品库存不足"),
    COMMODITY_OFF_SHELF(40406, "商品已下架"),
    
    // 订单相关错误
    ORDER_NOT_EXIST(40407, "订单不存在"),
    ORDER_STATUS_ERROR(40408, "订单状态错误"),
    ORDER_PAYMENT_ERROR(40409, "订单支付失败"),
    
    // 支付相关错误
    PAYMENT_ERROR(40410, "支付失败"),
    PAYMENT_TIMEOUT(40411, "支付超时"),
    REFUND_ERROR(40412, "退款失败");

    /**
     * 状态码
     */
    private final int code;

    /**
     * 信息
     */
    private final String message;

    ErrorCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}